package com.ruoyi.canteen.service.impl;

import java.util.List;

import com.ruoyi.canteen.vo.CanteenOrderItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.canteen.mapper.CanteenCpOrderDetailMapper;
import com.ruoyi.canteen.domain.CanteenCpOrderDetail;
import com.ruoyi.canteen.service.ICanteenCpOrderDetailService;

/**
 * 订单明细Service业务层处理
 * 
 * @author zhangw
 * @date 2021-09-19
 */
@Service
public class CanteenCpOrderDetailServiceImpl implements ICanteenCpOrderDetailService 
{
    @Autowired
    private CanteenCpOrderDetailMapper canteenCpOrderDetailMapper;

    /**
     * 查询订单明细
     * 
     * @param id 订单明细主键
     * @return 订单明细
     */
    @Override
    public CanteenCpOrderDetail selectCanteenCpOrderDetailById(Long id)
    {
        return canteenCpOrderDetailMapper.selectCanteenCpOrderDetailById(id);
    }

    /**
     * 查询订单明细列表
     * 
     * @param canteenCpOrderDetail 订单明细
     * @return 订单明细
     */
    @Override
    public List<CanteenCpOrderDetail> selectCanteenCpOrderDetailList(CanteenCpOrderDetail canteenCpOrderDetail)
    {
        return canteenCpOrderDetailMapper.selectCanteenCpOrderDetailList(canteenCpOrderDetail);
    }

    /**
     * 新增订单明细
     * 
     * @param canteenCpOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int insertCanteenCpOrderDetail(CanteenCpOrderDetail canteenCpOrderDetail)
    {
        return canteenCpOrderDetailMapper.insertCanteenCpOrderDetail(canteenCpOrderDetail);
    }

    /**
     * 修改订单明细
     * 
     * @param canteenCpOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int updateCanteenCpOrderDetail(CanteenCpOrderDetail canteenCpOrderDetail)
    {
        return canteenCpOrderDetailMapper.updateCanteenCpOrderDetail(canteenCpOrderDetail);
    }

    /**
     * 批量删除订单明细
     * 
     * @param ids 需要删除的订单明细主键
     * @return 结果
     */
    @Override
    public int deleteCanteenCpOrderDetailByIds(Long[] ids)
    {
        return canteenCpOrderDetailMapper.deleteCanteenCpOrderDetailByIds(ids);
    }

    /**
     * 删除订单明细信息
     * 
     * @param id 订单明细主键
     * @return 结果
     */
    @Override
    public int deleteCanteenCpOrderDetailById(Long id)
    {
        return canteenCpOrderDetailMapper.deleteCanteenCpOrderDetailById(id);
    }

    /**
     * 通过主订单id，查询子订单详情
     * @param orderId
     * @return
     */
    @Override
    public List<CanteenOrderItemVo> selectOrderDetailListByOrderId(Long orderId){
        return canteenCpOrderDetailMapper.selectOrderDetailListByOrderId(orderId);
    }
}
